package com.hypertech.core.ffmpeg.videoDao;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.io.InputStream;
import java.util.List;

@Repository
@Slf4j
public class VideoDao implements Runnable{
    private VideoOptions options = new VideoOptions();

    public void runCmd(List<String> command) {
        /*String result="";*/
        ProcessBuilder builder = new ProcessBuilder();
        builder.command(command);
        try {
            builder.redirectErrorStream(true);
            Process process = builder.start();
            log.info(builder.command().toString());
            int i = process.waitFor();
            log.warn("Process exitValue: "+i);
            /*InputStream in=process.getInputStream();

            byte[] re=new byte[1024];

            while (in.read(re)!= -1) {

                log.warn(new String(re));

                result = result + new String(re);

            }
            in.close();*/

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void run() {

    }

    public static void main(String[] args) {
        VideoDao videoDao = new VideoDao();

    }

}
